package cn.memset.code.functionInterface;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PredicateExample {
    public static void main(String[] args) {
        testPredicate();
    }

    public static void testPredicate() {
        List<String> provinces = new ArrayList<>(Arrays.asList("Guangdong", "Jiangsu", "Guangxi", "Jiangxi", "Shandong"));

        // 过滤掉 G 开头的省份
        boolean removed = provinces.removeIf(s -> {
            return s.startsWith("G");
        });

        System.out.println(removed);
        System.out.println(provinces);
    }
}
